<template>
  <div class="dashboard-container">
    <h1>试卷智能批改系统</h1>
    
    <Uploader @grading-complete="handleGradingComplete" />
    
    <AnswerBox v-if="result" :result="result" />
    
    <div class="history-link">
      <router-link to="/history">查看批改历史 →</router-link>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue';
import Uploader from '../components/Uploader.vue';
import AnswerBox from '../components/AnswerBox.vue';

const result = ref(null);

const handleGradingComplete = (gradingResult) => {
  result.value = gradingResult;
  // 这里可以添加保存到历史记录的逻辑
};
</script>

<style scoped>
.dashboard-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

h1 {
  text-align: center;
  margin-bottom: 40px;
  color: #409EFF;
}

.history-link {
  margin-top: 30px;
  text-align: right;
}

.history-link a {
  color: #409EFF;
  text-decoration: none;
}

.history-link a:hover {
  text-decoration: underline;
}
</style>